/*! ******************************************************************************
 *
 * Pentaho
 *
 * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com
 *
 * Use of this software is governed by the Business Source License included
 * in the LICENSE.TXT file.
 *
 * Change Date: 2029-07-20
 ******************************************************************************/


package org.pentaho.runtime.test.test.impl;

import org.pentaho.runtime.test.action.RuntimeTestAction;
import org.pentaho.runtime.test.result.RuntimeTestEntrySeverity;
import org.pentaho.runtime.test.result.RuntimeTestResultEntry;

/**
 * Created by bryan on 8/12/15.
 */
public class RuntimeTestResultEntryImpl implements RuntimeTestResultEntry {
  private final RuntimeTestEntrySeverity severity;
  private final String description;
  private final String message;
  private final Throwable exception;
  private final RuntimeTestAction runtimeTestAction;

  public RuntimeTestResultEntryImpl( RuntimeTestEntrySeverity severity, String description, String message ) {
    this( severity, description, message, (Throwable) null );
  }

  public RuntimeTestResultEntryImpl( RuntimeTestEntrySeverity severity, String description, String message,
                                     RuntimeTestAction runtimeTestAction ) {
    this( severity, description, message, null, runtimeTestAction );
  }

  public RuntimeTestResultEntryImpl( RuntimeTestEntrySeverity severity, String description, String message,
                                     Throwable exception ) {
    this( severity, description, message, exception, null );
  }

  public RuntimeTestResultEntryImpl( RuntimeTestEntrySeverity severity, String description, String message,
                                     Throwable exception, RuntimeTestAction runtimeTestAction ) {
    this.severity = severity;
    this.description = description;
    this.message = message;
    this.exception = exception;
    this.runtimeTestAction = runtimeTestAction;
  }

  @Override public RuntimeTestEntrySeverity getSeverity() {
    return severity;
  }

  @Override public String getDescription() {
    return description;
  }

  @Override public String getMessage() {
    return message;
  }

  @Override public Throwable getException() {
    return exception;
  }

  @Override public RuntimeTestAction getAction() {
    return runtimeTestAction;
  }

  //OperatorWrap isn't helpful for autogenerated methods
  //CHECKSTYLE:OperatorWrap:OFF
  @Override public String toString() {
    return "RuntimeTestResultEntryImpl{" +
      "severity=" + severity +
      ", description='" + description + '\'' +
      ", message='" + message + '\'' +
      ", exception=" + exception +
      '}';
  }
  //CHECKSTYLE:OperatorWrap:ON
}
